<script>
$(document).ready(function(){
	$(function() {
		//hide datepicker
		$("#dd").hide();
		
		//date load
		$( "#datepicker" ).datepicker();
	});
	
	$('#date_check').change(function(){
		$("#dd").toggle();
	})
});
</script>

<style>
.border_form {
	border: thin solid #003333;
}

.date_org {
	background-color:#EBFBCA;
	background-image:url(../images/graphic/calendar-day.png);
	background-repeat: no-repeat;
	padding-left: 18px;
	width: 150px;
}
</style>

<br/>
<table width="70%" border="0" cellspacing="1" cellpadding="3">
<tr>
        <td width="220">เลือกหน่วยงาน</td>
        <td>
        	<select name="major" id="major" class="border_form">
            	<option value="" disabled="disabled" selected="selected">เลือกหน่วยงาน</option>
            	<?php
					$query = $this->db->get('organization');
					foreach($query->result() as $rows){
						$org_id = $rows->org_id;
						$org_name = $rows->org_name;
				?>
            	<option value="<?=$org_id?>"><?=$org_name?></option>
                <?php
				}
                ?>
            </select>
        </td>
        <td>
        	<div id="major_description"></div>
        </td>
</tr>
<tr><td>&nbsp;</td></tr>
<tr>
	<td width="220">ระบุวันที่ <input type="checkbox" name="date_check" id="date_check"></td>
    <td>
    <div id="dd">
    	<select name="date_choose" id="date_choose">
            <option value="" disabled style="font-weight:bold; font-style:italic;" selected>ระบุปี</option>
            <?php
					$query1 = $this->db->query('SELECT DISTINCT extract( year FROM c_org_date ) AS years FROM content_of_organization GROUP BY c_org_date');
					foreach($query1->result() as $rows1){
						$years_list = $rows1->years;
			?>
            <option value="<?=$years_list?>"><?=$years_list?></option>
            <?php
			}
			?>
        </select>
    </div>
    </td>
</tr>
<tr><td>&nbsp;</td></tr>
    </table>